﻿#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QPushButton>
#include"open.h"
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QWidget*one=new QWidget;
        QPushButton *brt=new QPushButton;
        QPushButton *brt2=new QPushButton;
        brt->setParent(this);
        brt2->setParent(this);
        resize(500,500);
        brt->move(100,200);
        brt2->move(300,200);
        brt->setParent(this);
        brt->setText("open");
        brt2->setParent(this);
        brt2->setText("close");
        setWindowTitle("作业");
        connect(brt,&QPushButton::clicked,one,[=](){
                one->show();
        });

        connect(brt2,&QPushButton::clicked,one,[=](){
                if(brt2->text()=="close")
                {
                 one->close();
                 brt2->setText("open");
                                     }
                else{
                    one->show();
                    brt2->setText("close");
                }

        });


}

MainWindow::~MainWindow()
{
    delete ui;
}

